** Supplementary material 2**
**Publication preparations**

**Data Management**
*-------------------------------------------------------------------*
** Set globals **
*-------------------------------------------------------------------*

** Shortcut to where data is stored
global path ""C:\Users\79952rfa\OneDrive - Erasmus University Rotterdam\Local Pharmaceutical System\Manuscript 4 - Multilevel Analyses\Indonesia meds availability\Testt\1.Dataset""
global outPATH ""C:\Users\79952rfa\OneDrive - Erasmus University Rotterdam\Local Pharmaceutical System\Manuscript 4 - Multilevel Analyses\Indonesia meds availability\Testt\3.Output""
global tempPATH ""C:\Users\79952rfa\OneDrive - Erasmus University Rotterdam\Local Pharmaceutical System\Manuscript 4 - Multilevel Analyses\Indonesia meds availability\Testt\3.Output_temp""

** Shortcut for name of dataset
global data ""Cleaned puskesmas data without any intervention .dta""
global dataspss ""Cleaned puskesmas data without any intervention .sav""
global dhodata ""Cleaned DHO without any interventions.dta""
global dhodataspss ""Cleaned DHO without any interventions.sav""
global dho2data ""modif district characteristic.dta""
global dho2dataspss ""modif district characteristic.sav""
global data2 ""Cleaned puskesmas for category.dta""
global data2spss ""Cleaned puskesmas for category.sav""
global dho50 ""Cleaned DHO- 50 most needed medicinessav.dta""
global dho50spss ""Cleaned DHO- 50 most needed medicinessav.sav""
global med50 ""Medicine availability at PHC 50 medicines.dta""
global med50spss ""Medicine availability at PHC 50 medicines.sav""

*-------------------------------------------------------------------*
** Compile distances data
*-------------------------------------------------------------------*

** distances from PHC to DC
cd $path
import delimited "phc_dc_distance.csv", clear

keep b1r5 hubdist
rename (b1r5 hubdist) (B1R5 DC_distance_m)

save phc_dc_distance.dta, replace

** Distances from PHC to PC
cd $path
import delimited "phc_pc_distance.csv", clear

keep b1r5 hubdist
rename (b1r5 hubdist) (B1R5 PC_distance_m)

save phc_pc_distance.dta, replace

** Distances from PHC to nearest PHC
cd $path
import delimited "phc_nearest.csv", clear

keep inputid targetid distance
rename (inputid targetid distance) (B1R5 target_B1R5 PHC_distance_m)

** Chekc for duplicates
*duplicates list B1R5
duplicates drop B1R5, force

save phc_nearest.dta, replace


**Bivariate analyses

*-------------------------------------------------------------------*
** Explore and compile data
*-------------------------------------------------------------------*

** Open data
cd $path
use $data, clear

** Check outcome variable
** Quite normally distributed
*hist total60
*hist percn_60 

** Change some facility ID
replace B1R5 = 1011890 if B1R5 == 1011891
replace B1R5 = 1011891 if B1R5 == 2011891
replace B1R5 = 1011889 if B1R5 == 1701043
replace B1R5 = 1050669 if B1R5 == 1050272
replace B1R5 = 1030191 if B1R5 == 1030193
replace B1R5 = 1030120 if B1R5 == 1030121

** Merge with spatial information
duplicates list B1R5 // No duplicates
merge 1:1 B1R5 using Puskesmas_gps.dta

** Drop those from using only
drop if _merge == 2

** Clean coordinates
replace phclat = phclat *-1 if districtid > 3600 & districtid < 3700 & phclat!=.
replace phclong = phclong*10 if phclong<10
replace phclat = -3.285493 if B1R5 == 1071005
replace phclong = 122.1573351 if B1R5 == 1071005

** Check missing coordinates
br B1R5 if _merge==1 // 6 missing GPs
drop _merge

** Merge with district data
merge m:1 districtid using  $dhodata // all matched
drop _merge

** Merge with distances
merge 1:1 B1R5 using phc_dc_distance // all merged
drop _merge

merge 1:1 B1R5 using phc_pc_distance // all merged
drop _merge

merge 1:m B1R5 using phc_nearest //all merged
drop _merge

** Epxlore distances
sum DC_distance_m PC_distance_m PHC_distance_m

/*
    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
DC_distanc~m |      9,831    21086.34    85089.25   44.23477    8162531
PC_distanc~m |      9,831      110002    128898.7   171.6861    8162531
PHC_distan~m |      9,831    7039.024    82456.59          0    8141698

*/

** Merge with district information data
merge m:1 districtid using $dho2data, keepusing(districtid pulau) //all merged
drop _merge

** Merge with data on HF category
rename recode_B3R6V2 recode_B3R6V2_old
merge m:1 B1R5 using $data2, keepusing(B1R5 recode_B3R6V2 B3R10 B3R3 B3R8) //all merged
drop _merge

** Merge with additional DHO data
merge m:1 districtid using $dho50, keepusing( ficalcapacity districtid new50meddho ) //all merged
drop _merge

rename new50meddho dho_med50

** Merge with 50 meds puskesmas
merge 1:1 B1R5 using $med50, keepusing( B1R5 new50med percentageof50 ) //all merged
drop _merge

rename (new50med percentageof50) (total50med percn_50)

** Export histogram of outcome var
*cd$outPATH
*hist total50med
*graph export "Histogram_50meds.png"


*-------------------------------------------------------------------*
** Dimension Model 1: Managing Human and Physical Resource
*-------------------------------------------------------------------*

** Puskesmas level
*--------------------------------------------------------------------

** Tabulate all variables
tab1 B8R1K3_14_ori-recode_B126R4D,missing // 4 HF miss data on # of pharmacists, no mising data otherwise

** Make pharmacist availability binary
gen recode_B8R1K3_14_ori = 0, a(B8R1K3_14_ori)
replace recode_B8R1K3_14_ori = 1 if B8R1K3_14_ori > 0 & B8R1K3_14_ori <.


tab B8R1K3_14_ori recode_B8R1K3_14_ori ,m  // all good, 

** Correlation matrix for all variables
pwcorr recode_B8R1K3_14_ori-recode_B126R4D  // high correlation between recode_B122R11Cv2 & recode_B122R11 (r = 0.89)

/*

             | recode~i rec~1Cv1 rec~1Cv2 rec~1Av1 rec~1Bv1 recod~11 rec~6R4A
-------------+---------------------------------------------------------------
recode_B8R~i |   1.0000 
recode_~1Cv1 |   0.0780   1.0000 
recode_~1Cv2 |   0.0377   0.2340   1.0000 
recode_~1Av1 |   0.0526   0.4190   0.1825   1.0000 
recode_~1Bv1 |   0.0945   0.5485   0.2247   0.5033   1.0000 
recode_B1~11 |   0.0768   0.8987   0.2103   0.4611   0.5927   1.0000 
recode_~6R4A |   0.0809   0.1108   0.0994   0.0792   0.0915   0.1090   1.0000 
recode_~6R4B |   0.1112   0.1310   0.1157   0.0729   0.1043   0.1215   0.6692 
recode_B1~4C |   0.1257   0.1503   0.1256   0.0836   0.1145   0.1422   0.5599 
recode_B1~4D |   0.0923   0.1185   0.1097   0.0839   0.0971   0.1149   0.5450 

             | rec~6R4B recod~4C recod~4D
-------------+---------------------------
recode_~6R4B |   1.0000 
recode_B1~4C |   0.6851   1.0000 
recode_B1~4D |   0.5965   0.7328   1.0000 


*/

** Linear regression
regress total50 recode_B8R1K3_14_ori recode_B122R11Cv1 recode_B122R11Cv2 recode_B122R11Av1 recode_B122R11Bv1 recode_B122R11 recode_B126R4A recode_B126R4B recode_B126R4C recode_B126R4D B3R3 B3R8 // Take out recode_B122R11Av1

/*


--------------------------------------------------------------------------------------
          total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
recode_B8R1K3_14_ori |   1.701745   .1328126    12.81   0.000     1.441406    1.962085
   recode_B122R11Cv1 |   1.726191    .677187     2.55   0.011     .3987654    3.053617
   recode_B122R11Cv2 |   .2373163   .1164236     2.04   0.042     .0091021    .4655305
   recode_B122R11Av1 |   .0359513   .1982664     0.18   0.856    -.3526916    .4245942
   recode_B122R11Bv1 |   .6565299   .2685902     2.44   0.015     .1300379    1.183022
      recode_B122R11 |   .5204967   .7786418     0.67   0.504    -1.005801    2.046795
      recode_B126R4A |   .3727986   .1889168     1.97   0.048     .0024827    .7431145
      recode_B126R4B |   .6827752    .242288     2.82   0.005     .2078408     1.15771
      recode_B126R4C |   1.233345    .286863     4.30   0.000     .6710344    1.795655
      recode_B126R4D |   -.299417    .226402    -1.32   0.186    -.7432115    .1443775
                B3R3 |   1.662353   .1124421    14.78   0.000     1.441944    1.882763
                B3R8 |   2.136299    .143945    14.84   0.000     1.854137    2.418461
               _cons |   24.71622   .3464645    71.34   0.000     24.03707    25.39536
--------------------------------------------------------------------------------------


*/

regress total50 recode_B8R1K3_14_ori recode_B122R11Cv1 recode_B122R11Cv2 /*recode_B122R11Av1*/ recode_B122R11Bv1 recode_B122R11 recode_B126R4A recode_B126R4B recode_B126R4C recode_B126R4D B3R3 B3R8 // Take out recode_B122R11

/*


--------------------------------------------------------------------------------------
          total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
recode_B8R1K3_14_ori |   1.701774    .132806    12.81   0.000     1.441447    1.962101
   recode_B122R11Cv1 |   1.725238   .6771332     2.55   0.011     .3979176    3.052558
   recode_B122R11Cv2 |   .2386294   .1161924     2.05   0.040     .0108684    .4663904
   recode_B122R11Bv1 |   .6717901   .2550525     2.63   0.008     .1718347    1.171745
      recode_B122R11 |   .5387079   .7720996     0.70   0.485    -.9747661    2.052182
      recode_B126R4A |   .3734872   .1888694     1.98   0.048     .0032644      .74371
      recode_B126R4B |   .6822236    .242257     2.82   0.005       .20735    1.157097
      recode_B126R4C |   1.232854   .2868361     4.30   0.000      .670596    1.795111
      recode_B126R4D |  -.2984902   .2263331    -1.32   0.187    -.7421497    .1451693
                B3R3 |   1.662163   .1124316    14.78   0.000     1.441774    1.882552
                B3R8 |   2.135802   .1439118    14.84   0.000     1.853705    2.417899
               _cons |   24.71616   .3464473    71.34   0.000     24.03705    25.39527
--------------------------------------------------------------------------------------


*/

regress total50 recode_B8R1K3_14_ori recode_B122R11Cv1 recode_B122R11Cv2 /*recode_B122R11Av1*/ recode_B122R11Bv1 /*recode_B122R11*/ recode_B126R4A recode_B126R4B recode_B126R4C recode_B126R4D B3R3 B3R8 // Take out recode_B126R4D

/*


--------------------------------------------------------------------------------------
          total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
recode_B8R1K3_14_ori |   1.701654   .1328024    12.81   0.000     1.441334    1.961974
   recode_B122R11Cv1 |   2.126194   .3581341     5.94   0.000     1.424178     2.82821
   recode_B122R11Cv2 |   .2359161   .1161243     2.03   0.042     .0082887    .4635436
   recode_B122R11Bv1 |   .7203992   .2453465     2.94   0.003     .2394697    1.201329
      recode_B126R4A |   .3754908   .1888426     1.99   0.047     .0053204    .7456611
      recode_B126R4B |   .6798869   .2422275     2.81   0.005     .2050711    1.154703
      recode_B126R4C |   1.233808   .2868253     4.30   0.000     .6715718    1.796045
      recode_B126R4D |   -.297476   .2263226    -1.31   0.189    -.7411147    .1461628
                B3R3 |   1.662665   .1124264    14.79   0.000     1.442286    1.883044
                B3R8 |   2.134983   .1439033    14.84   0.000     1.852903    2.417063
               _cons |    24.8086   .3201005    77.50   0.000     24.18114    25.43607
--------------------------------------------------------------------------------------


*/

regress total50 recode_B8R1K3_14_ori recode_B122R11Cv1 recode_B122R11Cv2 /*recode_B122R11Av1*/ recode_B122R11Bv1 /*recode_B122R11*/ recode_B126R4A recode_B126R4B recode_B126R4C B3R3 B3R8 /*recode_B126R4D*/ // take out recode_B126R4A  

/*


--------------------------------------------------------------------------------------
          total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
recode_B8R1K3_14_ori |   1.702912   .1328038    12.82   0.000     1.442589    1.963234
   recode_B122R11Cv1 |   2.128706   .3581422     5.94   0.000     1.426674    2.830739
   recode_B122R11Cv2 |    .233853    .116118     2.01   0.044     .0062379    .4614681
   recode_B122R11Bv1 |   .7175935   .2453463     2.92   0.003     .2366644    1.198523
      recode_B126R4A |   .3329089   .1860499     1.79   0.074     -.031787    .6976049
      recode_B126R4B |   .6515518   .2412753     2.70   0.007     .1786027    1.124501
      recode_B126R4C |   1.036386    .244362     4.24   0.000     .5573858    1.515385
                B3R3 |   1.663744   .1124275    14.80   0.000     1.443363    1.884125
                B3R8 |   2.133195   .1439022    14.82   0.000     1.851117    2.415273
               _cons |   24.79268   .3198829    77.51   0.000     24.16564    25.41971
--------------------------------------------------------------------------------------


*/
** Unadjusted Model 1
regress total50 recode_B8R1K3_14_ori recode_B122R11Cv1 recode_B122R11Cv2 recode_B122R11Bv1 recode_B126R4B recode_B126R4C B3R3 B3R8 
estat ic // AIC : 61058

/*

      Source |       SS           df       MS      Number of obs   =     9,831
-------------+----------------------------------   F(8, 9822)      =    178.28
       Model |  41559.5637         8  5194.94546   Prob > F        =    0.0000
    Residual |  286198.365     9,822  29.1385018   R-squared       =    0.1268
-------------+----------------------------------   Adj R-squared   =    0.1261
       Total |  327757.929     9,830  33.3426174   Root MSE        =     5.398

--------------------------------------------------------------------------------------
          total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------------+----------------------------------------------------------------
recode_B8R1K3_14_ori |   1.701017   .1328145    12.81   0.000     1.440674    1.961361
   recode_B122R11Cv1 |   2.130878   .3581803     5.95   0.000     1.428771    2.832985
   recode_B122R11Cv2 |   .2366451   .1161205     2.04   0.042      .009025    .4642652
   recode_B122R11Bv1 |   .7218259   .2453624     2.94   0.003     .2408652    1.202787
      recode_B126R4B |   .8541589     .21308     4.01   0.000     .4364783    1.271839
      recode_B126R4C |   1.114212    .240487     4.63   0.000     .6428081    1.585616
                B3R3 |     1.6707   .1123729    14.87   0.000     1.450426    1.890974
                B3R8 |   2.135745   .1439113    14.84   0.000      1.85365    2.417841
               _cons |   24.80552   .3198383    77.56   0.000     24.17857    25.43246
--------------------------------------------------------------------------------------


Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      9,831  -31186.94  -30520.45       9   61058.89   61123.63
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.

*/

** Give prefix to selected variables
foreach var of varlist recode_B8R1K3_14_ori recode_B122R11Cv1 recode_B122R11Cv2 /*recode_B122R11Av1*/ recode_B122R11Bv1 /*recode_B122R11*/ /*recode_B126R4A*/ recode_B126R4B recode_B126R4C B3R3 B3R8 /*recode_B126R4D*/ {
rename `var' m1_`var'
}

** DHO level
*--------------------------------------------------------------------

** Tabulate all variables
tab1  dho_avail_pharmacist dho_PIC_pharmacist dho_ideal_PIC_pharmacist,m // no missing data


** Correlation matrix for all variables
pwcorr dho_avail_pharmacist dho_PIC_pharmacist dho_ideal_PIC_pharmacist  // dho_PIC_pharmacist dho_ideal_PIC_pharmacist high correlation r = 0.825

/*

             | dho_av~t dho_PI~t dho_id~t
-------------+---------------------------
dho_avail_~t |   1.0000 
dho_PIC_ph~t |   0.0569   1.0000 
dho_ideal_~t |   0.0625   0.8253   1.0000 

*/

** Linear regression
regress total50 dho_avail_pharmacist dho_PIC_pharmacist dho_ideal_PIC_pharmacist // Take out dho_PIC_pharmacist

/*


------------------------------------------------------------------------------------------
              total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------------------+----------------------------------------------------------------
    dho_avail_pharmacist |  -.1007744   .1958287    -0.51   0.607    -.4846388      .28309
      dho_PIC_pharmacist |  -.0992827    .308057    -0.32   0.747    -.7031377    .5045723
dho_ideal_PIC_pharmacist |   .6573533   .2696267     2.44   0.015     .1288297    1.185877
                   _cons |   32.68103   .2335905   139.91   0.000     32.22314    33.13891
------------------------------------------------------------------------------------------


*/

regress total50 dho_avail_pharmacist /*dho_PIC_pharmacist*/ dho_ideal_PIC_pharmacist // Take out dho_avail_pharmacist

/*


------------------------------------------------------------------------------------------
              total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------------------+----------------------------------------------------------------
    dho_avail_pharmacist |   -.101374   .1958109    -0.52   0.605    -.4852036    .2824556
dho_ideal_PIC_pharmacist |   .5856878   .1524792     3.84   0.000     .2867972    .8845784
                   _cons |   32.65396   .2179555   149.82   0.000     32.22672    33.08119
------------------------------------------------------------------------------------------


*/

** Unadjusted model 1 DHO
regress total50 /*dho_avail_pharmacist dho_PIC_pharmacist*/ dho_ideal_PIC_pharmacist // Take out dho_avail_pharmacist
estat ic 
/*

      Source |       SS           df       MS      Number of obs   =     9,831
-------------+----------------------------------   F(1, 9829)      =     14.56
       Model |  484.949938         1  484.949938   Prob > F        =    0.0001
    Residual |  327272.979     9,829   33.296671   R-squared       =    0.0015
-------------+----------------------------------   Adj R-squared   =    0.0014
       Total |  327757.929     9,830  33.3426174   Root MSE        =    5.7703

------------------------------------------------------------------------------------------
              total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
dho_ideal_PIC_pharmacist |    .580755   .1521756     3.82   0.000     .2824597    .8790504
                   _cons |   32.56661   .1379766   236.03   0.000     32.29615    32.83707
------------------------------------------------------------------------------------------

. estat ic 

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      9,831  -31186.94  -31179.66       2   62363.32   62377.71
*/

** Give prefix to selected variables
foreach var of varlist /*dho_avail_pharmacist dho_PIC_pharmacist*/ dho_ideal_PIC_pharmacist {
rename `var' dho_m1_`var'
}


*-------------------------------------------------------------------*
** Dimension Model 2: Financing
*-------------------------------------------------------------------*

** Puskesmas level
*--------------------------------------------------------------------

** Tabulate all variables
tab1 recode_B13R2ATERSEDIAv1-recode_B13R2ETERSEDIAv1, m // 1 or 2 missings per variable no reas


** Correlation matrix for all variables
pwcorr recode_B13R2ATERSEDIAv1 recode_B13R2BTERSEDIAv1 recode_B13R2CTERSEDIAv1 recode_B13R2DTERSEDIAv1 recode_B13R2ETERSEDIAv1 B3R10 // no issues


/*

             | r~ATER~1 r~BTER~1 r~CTER~1 r~DTER~1 r~ETER~1    B3R10
-------------+------------------------------------------------------
r~ATERSEDI~1 |   1.0000 
r~BTERSEDI~1 |  -0.0136   1.0000 
r~CTERSEDI~1 |   0.0803   0.2076   1.0000 
r~DTERSEDI~1 |   0.2561   0.1896   0.2222   1.0000 
r~ETERSEDI~1 |   0.0672   0.1571   0.3478   0.2656   1.0000 
       B3R10 |  -0.1647   0.0008   0.1938  -0.1380   0.1122   1.0000 

*/


** Linear regression
regress total50 recode_B13R2ATERSEDIAv1 recode_B13R2BTERSEDIAv1 recode_B13R2CTERSEDIAv1 recode_B13R2DTERSEDIAv1 recode_B13R2ETERSEDIAv1 B3R10 // Take out recode_B13R2ATERSEDIAv1

/*


-----------------------------------------------------------------------------------------
             total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------------+----------------------------------------------------------------
recode_B13R2ATERSEDIAv1 |  -.0660337   .1395214    -0.47   0.636    -.3395245     .207457
recode_B13R2BTERSEDIAv1 |   .2518428   .1213271     2.08   0.038     .0140167    .4896688
recode_B13R2CTERSEDIAv1 |   1.532769   .1325645    11.56   0.000     1.272916    1.792623
recode_B13R2DTERSEDIAv1 |   .2976167    .318526     0.93   0.350    -.3267597    .9219931
recode_B13R2ETERSEDIAv1 |   1.957487    .130598    14.99   0.000     1.701488    2.213486
                  B3R10 |   1.094685   .1256865     8.71   0.000     .8483139    1.341057
                  _cons |   29.95617   .2970635   100.84   0.000     29.37387    30.53848
-----------------------------------------------------------------------------------------



*/


regress total50 /*recode_B13R2ATERSEDIAv1*/ recode_B13R2BTERSEDIAv1 recode_B13R2CTERSEDIAv1 recode_B13R2DTERSEDIAv1 recode_B13R2ETERSEDIAv1 B3R10 // Take out recode_B13R2DTERSEDIAv1

/*




-----------------------------------------------------------------------------------------
             total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------------+----------------------------------------------------------------
recode_B13R2BTERSEDIAv1 |   .2560918   .1209897     2.12   0.034     .0189271    .4932565
recode_B13R2CTERSEDIAv1 |   1.528683   .1322778    11.56   0.000     1.269391    1.787974
recode_B13R2DTERSEDIAv1 |   .2645082   .3107371     0.85   0.395    -.3446004    .8736167
recode_B13R2ETERSEDIAv1 |   1.956921   .1305874    14.99   0.000     1.700943      2.2129
                  B3R10 |   1.103393   .1243276     8.87   0.000     .8596855    1.347101
                  _cons |    29.9347   .2935668   101.97   0.000     29.35925    30.51015
-----------------------------------------------------------------------------------------



*/
** Unadjusted Model 2:
regress total50 /*recode_B13R2ATERSEDIAv1*/ recode_B13R2BTERSEDIAv1 recode_B13R2CTERSEDIAv1 /*recode_B13R2DTERSEDIAv1*/ recode_B13R2ETERSEDIAv1 B3R10 // Take out recode_B13R2DTERSEDIAv1
estat ic
/*


      Source |       SS           df       MS      Number of obs   =     9,829
-------------+----------------------------------   F(4, 9824)      =    196.81
       Model |  24305.8154         4  6076.45385   Prob > F        =    0.0000
    Residual |  303305.947     9,824  30.8739767   R-squared       =    0.0742
-------------+----------------------------------   Adj R-squared   =    0.0738
       Total |  327611.762     9,828  33.3345302   Root MSE        =    5.5564

-----------------------------------------------------------------------------------------
             total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
------------------------+----------------------------------------------------------------
recode_B13R2BTERSEDIAv1 |   .2688478   .1199828     2.24   0.025     .0336568    .5040387
recode_B13R2CTERSEDIAv1 |   1.545719   .1306573    11.83   0.000     1.289604    1.801835
recode_B13R2ETERSEDIAv1 |     1.9797   .1277008    15.50   0.000      1.72938    2.230019
                  B3R10 |   1.082993   .1218112     8.89   0.000     .8442183    1.321768
                  _cons |   30.16032    .126877   237.71   0.000     29.91161    30.40902
-----------------------------------------------------------------------------------------

. estat ic

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      9,829   -31179.4  -30800.56       5   61611.11   61647.08
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.



*/


** Give prefix to selected variables
foreach var of varlist /*recode_B13R2ATERSEDIAv1*/ recode_B13R2BTERSEDIAv1 recode_B13R2CTERSEDIAv1 /*recode_B13R2DTERSEDIAv1*/ recode_B13R2ETERSEDIAv1 B3R10{
rename `var' m2_`var'
}

** DHO level
*--------------------------------------------------------------------

** Tabulate all variables
tab1  dho_recode_B662R12AK1v1-dho_recode_B662R12DK1v1

** Correlation matrix for all variables
pwcorr dho_recode_B662R12AK1v1 dho_recode_B662R12BK1v1 dho_recode_B662R12CK1v1 dho_recode_B662R12DK1v1  // No issues

/*

             | dh~AK1v1 dh~BK1v1 dh~CK1v1 dh~DK1v1
-------------+------------------------------------
dho_re~AK1v1 |   1.0000 
dho_re~BK1v1 |  -0.0705   1.0000 
dho_re~CK1v1 |   0.0060   0.0348   1.0000 
dho_re~DK1v1 |   0.1121   0.1724  -0.0181   1.0000 


*/

** Linear regression
regress total50 dho_recode_B662R12AK1v1 dho_recode_B662R12BK1v1 dho_recode_B662R12CK1v1 dho_recode_B662R12DK1v1 // Take out dho_recode_B662R12DK1v1

/*

-----------------------------------------------------------------------------------------
             total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------------+----------------------------------------------------------------
dho_recode_B662R12AK1v1 |   1.110549   .2315461     4.80   0.000     .6566714    1.564427
dho_recode_B662R12BK1v1 |   1.773593   .1874824     9.46   0.000     1.406089    2.141097
dho_recode_B662R12CK1v1 |    1.01288   .1169311     8.66   0.000     .7836716    1.242089
dho_recode_B662R12DK1v1 |  -.0588521   .1353697    -0.43   0.664    -.3242047    .2065004
                  _cons |   31.40001   .2288853   137.19   0.000     30.95135    31.84867
-----------------------------------------------------------------------------------------




*/
** Unadjusted model 2 DHO
regress total50 dho_recode_B662R12AK1v1 dho_recode_B662R12BK1v1 dho_recode_B662R12CK1v1 /*dho_recode_B662R12DK1v1*/ // 
estat ic
/*


      Source |       SS           df       MS      Number of obs   =     9,831
-------------+----------------------------------   F(3, 9827)      =     63.25
       Model |  6209.16708         3  2069.72236   Prob > F        =    0.0000
    Residual |  321548.762     9,827  32.7209486   R-squared       =    0.0189
-------------+----------------------------------   Adj R-squared   =    0.0186
       Total |  327757.929     9,830  33.3426174   Root MSE        =    5.7202

-----------------------------------------------------------------------------------------
             total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
------------------------+----------------------------------------------------------------
dho_recode_B662R12AK1v1 |   1.097789   .2296689     4.78   0.000     .6475909    1.547987
dho_recode_B662R12BK1v1 |   1.758702   .1843194     9.54   0.000     1.397398    2.120006
dho_recode_B662R12CK1v1 |   1.014191   .1168874     8.68   0.000      .785068    1.243314
                  _cons |   31.39794   .2288265   137.21   0.000      30.9494    31.84649
-----------------------------------------------------------------------------------------

. estat ic

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      9,831  -31186.94  -31092.92       4   62193.85   62222.62
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.

*/

** Give prefix to selected variables
foreach var of varlist dho_recode_B662R12AK1v1 dho_recode_B662R12BK1v1 dho_recode_B662R12CK1v1 /*dho_recode_B662R12DK1v1*/ {
rename `var' dho_m2_`var'
}

*-------------------------------------------------------------------*
** Dimension Model 3: M&E
*-------------------------------------------------------------------*

** Puskesmas level
*--------------------------------------------------------------------

** Tabulate all variables
tab1 simpus_av e_simpus ol_simpus, m // no issues
** Correlation matrix for all variables
pwcorr simpus_av e_simpus ol_simpus // high correlation

/*
             | simpus~v e_simpus ol_sim~s
-------------+---------------------------
   simpus_av |   1.0000 
    e_simpus |   0.6854   1.0000 
   ol_simpus |   0.5741   0.8376   1.0000 
*/

** Linear regression
regress total50  simpus_av e_simpus ol_simpus // taking_out simpus_av  

/* 

      Source |       SS           df       MS      Number of obs   =     9,831
-------------+----------------------------------   F(3, 9827)      =     56.87
       Model |  5592.82706         3  1864.27569   Prob > F        =    0.0000
    Residual |  322165.102     9,827  32.7836676   R-squared       =    0.0171
-------------+----------------------------------   Adj R-squared   =    0.0168
       Total |  327757.929     9,830  33.3426174   Root MSE        =    5.7257

------------------------------------------------------------------------------
  total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
   simpus_av |  -.1523005   .1633123    -0.93   0.351    -.4724261    .1678251
    e_simpus |   1.175293   .2399088     4.90   0.000     .7050223    1.645563
   ol_simpus |   .5217534   .2218098     2.35   0.019     .0869606    .9565463
       _cons |   32.44738   .0935752   346.75   0.000     32.26396    32.63081
------------------------------------------------------------------------------
*/

** Linear regression
regress total50med  /*simpus_av*/ e_simpus ol_simpus // taking_out simpus_av 

/*
      Source |       SS           df       MS      Number of obs   =     9,831
-------------+----------------------------------   F(2, 9828)      =     84.87
       Model |  5564.31539         2   2782.1577   Prob > F        =    0.0000
    Residual |  322193.613     9,828  32.7832329   R-squared       =    0.0170
-------------+----------------------------------   Adj R-squared   =    0.0168
       Total |  327757.929     9,830  33.3426174   Root MSE        =    5.7257

------------------------------------------------------------------------------
  total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
    e_simpus |   1.072994   .2133603     5.03   0.000     .6547642    1.491224
   ol_simpus |   .5217534   .2218084     2.35   0.019     .0869635    .9565434
       _cons |   32.39738   .0766906   422.44   0.000     32.24705    32.54771
------------------------------------------------------------------------------
*/

foreach var of varlist e_simpus ol_simpus{
rename `var' m3_`var'
}

*-------------------------------------------------------------------*
** Dimension Model 5: Managing Supply Chain
*-------------------------------------------------------------------*

** Puskesmas level
*--------------------------------------------------------------------*

** Tabulate all variables
tab1 recode_B4R10Bv1-B126R1 recode_B127R1v1, m // 32 missings for some va

** Correlation matrix for all variables
pwcorr recode_B4R10Bv1 recode_B4R10Bv2 recode_B121R7 recode_B121R1v1 recode_B121R4v2 som_DHOonly recode_B121R4v1 som_dhoandphc recode_B121R5v2 captiation_use captiation_use2 recode_B122R4A recode_B122R4B recode_B122R11F recode_B122R11G B126R1 recode_B127R1v1 // few >0.9; exclude som_DHOonly recode_B121R4v1 


/*
             | rec~0Bv1 rec~0Bv2 recode~7 re~1R1v1 reco~4v2 som_DH~y reco~4v1
-------------+---------------------------------------------------------------
recode_B4R~1 |   1.0000 
recode_B4R~2 |   0.4674   1.0000 
recode_B12~7 |   0.0128   0.0482   1.0000 
recode~1R1v1 |   0.0506   0.1347   0.1941   1.0000 
recode_B~4v2 |   0.0019   0.0432   0.0434   0.2170   1.0000 
 som_DHOonly |  -0.0019  -0.0432  -0.0434  -0.2170  -1.0000   1.0000 
recode_B~4v1 |  -0.0026   0.0013  -0.0059   0.0317   0.1460  -0.1460   1.0000 
som_dhoand~c |   0.0026   0.0431   0.0451   0.2103   0.9689  -0.9689  -0.1032 
recode_B~5v2 |   0.0138   0.0561   0.1592   0.3451  -0.0021   0.0021  -0.0268 
captiation~e |   0.0154   0.0364   0.0279   0.0842   0.2802  -0.2802   0.0149 
captiation~2 |   0.0004   0.0059  -0.0338  -0.0062   0.2798  -0.2798   0.0290 
recode_~2R4A |   0.0061   0.0542   0.1048   0.1340   0.1609  -0.1609   0.0467 
recode_~2R4B |   0.0019   0.0202  -0.0054   0.0154   0.4012  -0.4012   0.0121 
recode_B~11F |   0.0876   0.1808   0.0616   0.2035   0.0882  -0.0882   0.0018 
recode_B~11G |   0.0648   0.1457   0.0802   0.1691   0.0934  -0.0934  -0.0086 
      B126R1 |   0.0402   0.1399   0.1389   0.2203   0.1145  -0.1145   0.0033 

             | som_dh~c reco~5v2 captia~e captia~2 rec~2R4A rec~2R4B reco~11F
-------------+---------------------------------------------------------------
som_dhoand~c |   1.0000 
recode_B~5v2 |   0.0046   1.0000 
captiation~e |   0.2780   0.0325   1.0000 
captiation~2 |   0.2741  -0.0306   0.3107   1.0000 
recode_~2R4A |   0.1501   0.0492   0.3098  -0.0073   1.0000 
recode_~2R4B |   0.4004  -0.0218   0.4334   0.4772  -0.0027   1.0000 
recode_B~11F |   0.0883   0.0774   0.0615   0.0164   0.0916   0.0484   1.0000 
recode_B~11G |   0.0960   0.0643   0.0527   0.0102   0.1069   0.0403   0.5489 
      B126R1 |   0.1143   0.0883   0.0787   0.0251   0.1556   0.0556   0.1909 

             | reco~11G   B126R1
-------------+------------------
recode_B~11G |   1.0000 
      B126R1 |   0.2441   1.0000 

*/


** Linear regression
regress total50 recode_B4R10Bv1 recode_B4R10Bv2 recode_B121R7 recode_B121R1v1 recode_B121R4v2 /*som_DHOonly recode_B121R4v1*/ som_dhoandphc recode_B121R5v2 captiation_use captiation_use2 recode_B122R4A recode_B122R4B recode_B122R11F recode_B122R11G B126R1 recode_B127R1v1 // Take out captiation_use2

/*


---------------------------------------------------------------------------------
     total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
recode_B4R10Bv1 |    1.47945   .5954443     2.48   0.013     .3122564    2.646644
recode_B4R10Bv2 |   1.257997   .2964234     4.24   0.000     .6769463    1.839048
  recode_B121R7 |   .5597286   .1302065     4.30   0.000     .3044969    .8149603
recode_B121R1v1 |   .2817933   .2648985     1.06   0.287    -.2374625    .8010492
recode_B121R4v2 |  -.7616763   .4551024    -1.67   0.094    -1.653771    .1304184
  som_dhoandphc |   1.367459   .4552774     3.00   0.003     .4750215    2.259897
recode_B121R5v2 |   .3903928   .1243312     3.14   0.002     .1466779    .6341077
 captiation_use |  -.3084525   .1895073    -1.63   0.104     -.679926     .063021
captiation_use2 |  -.0556535   .1324652    -0.42   0.674    -.3153125    .2040056
 recode_B122R4A |   .8056244   .1253837     6.43   0.000     .5598465    1.051402
 recode_B122R4B |   .8796591    .141194     6.23   0.000     .6028896    1.156428
recode_B122R11F |   1.102354   .3085438     3.57   0.000     .4975449    1.707164
recode_B122R11G |   2.739077   .2464512    11.11   0.000     2.255982    3.222173
         B126R1 |   2.116472   .1688504    12.53   0.000      1.78549    2.447453
recode_B127R1v1 |   1.009314   .1501528     6.72   0.000     .7149839    1.303645
          _cons |   22.52714   .5997103    37.56   0.000     21.35159     23.7027
---------------------------------------------------------------------------------


*/


regress total50 recode_B4R10Bv1 recode_B4R10Bv2 recode_B121R7 recode_B121R1v1 recode_B121R4v2 /*som_DHOonly recode_B121R4v1*/ som_dhoandphc recode_B121R5v2 captiation_use /*captiation_use2*/ recode_B122R4A recode_B122R4B recode_B122R11F recode_B122R11G B126R1 recode_B127R1v1 // Take out recode_B121R1v1

/*


---------------------------------------------------------------------------------
     total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
recode_B4R10Bv1 |   1.479157   .5954188     2.48   0.013     .3120129    2.646301
recode_B4R10Bv2 |   1.258305     .29641     4.25   0.000     .6772798    1.839329
  recode_B121R7 |   .5613686   .1301425     4.31   0.000     .3062624    .8164749
recode_B121R1v1 |   .2851858   .2647643     1.08   0.281    -.2338069    .8041785
recode_B121R4v2 |  -.7697421   .4546781    -1.69   0.090    -1.661005     .121521
  som_dhoandphc |   1.369681   .4552275     3.01   0.003     .4773408    2.262021
recode_B121R5v2 |   .3908903   .1243204     3.14   0.002     .1471967    .6345839
 captiation_use |  -.3193213   .1877254    -1.70   0.089    -.6873018    .0486592
 recode_B122R4A |   .8091137    .125103     6.47   0.000      .563886    1.054342
 recode_B122R4B |   .8595977   .1328693     6.47   0.000     .5991465    1.120049
recode_B122R11F |   1.102616   .3085302     3.57   0.000     .4978329    1.707399
recode_B122R11G |   2.739852   .2464339    11.12   0.000     2.256791    3.222913
         B126R1 |   2.116151   .1688415    12.53   0.000     1.785187    2.447115
recode_B127R1v1 |   1.009394   .1501464     6.72   0.000     .7150758    1.303712
          _cons |   22.52243   .5995799    37.56   0.000     21.34712    23.69773
---------------------------------------------------------------------------------



*/

regress total50 recode_B4R10Bv1 recode_B4R10Bv2 recode_B121R7 /*recode_B121R1v1*/ recode_B121R4v2 /*som_DHOonly recode_B121R4v1*/ som_dhoandphc recode_B121R5v2 captiation_use /*captiation_use2*/ recode_B122R4A recode_B122R4B recode_B122R11F recode_B122R11G B126R1 recode_B127R1v1 // Take out recode_B121R4v2

/*

---------------------------------------------------------------------------------
     total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
recode_B4R10Bv1 |   1.478576   .5954235     2.48   0.013     .3114232    2.645729
recode_B4R10Bv2 |   1.277403   .2958816     4.32   0.000     .6974141    1.857392
  recode_B121R7 |   .5770548   .1293262     4.46   0.000     .3235487    .8305609
recode_B121R4v2 |  -.7361723   .4536125    -1.62   0.105    -1.625346    .1530018
  som_dhoandphc |    1.36403    .455201     3.00   0.003     .4717417    2.256318
recode_B121R5v2 |   .4336684   .1178071     3.68   0.000     .2027422    .6645946
 captiation_use |  -.3160067   .1877017    -1.68   0.092    -.6839408    .0519273
 recode_B122R4A |   .8137834   .1250289     6.51   0.000      .568701    1.058866
 recode_B122R4B |   .8484215   .1324646     6.40   0.000     .5887634     1.10808
recode_B122R11F |   1.135433   .3070247     3.70   0.000     .5336012    1.737265
recode_B122R11G |   2.744457   .2463989    11.14   0.000     2.261465     3.22745
         B126R1 |   2.138088     .16761    12.76   0.000     1.809538    2.466639
recode_B127R1v1 |   1.019935   .1498283     6.81   0.000     .7262409     1.31363
          _cons |   22.65994   .5858354    38.68   0.000     21.51158     23.8083
---------------------------------------------------------------------------------


*/

regress total50 recode_B4R10Bv1 recode_B4R10Bv2 recode_B121R7 /*recode_B121R1v1*/ /*recode_B121R4v2*/ /*som_DHOonly recode_B121R4v1*/ som_dhoandphc recode_B121R5v2 captiation_use /*captiation_use2*/ recode_B122R4A recode_B122R4B recode_B122R11F recode_B122R11G B126R1 recode_B127R1v1 // Take out captiation_use

/*


---------------------------------------------------------------------------------
     total50med |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------+----------------------------------------------------------------
recode_B4R10Bv1 |   1.483259   .5954662     2.49   0.013     .3160221    2.650495
recode_B4R10Bv2 |    1.27511   .2959029     4.31   0.000     .6950789    1.855141
  recode_B121R7 |    .577524   .1293367     4.47   0.000     .3239973    .8310506
  som_dhoandphc |    .653883   .1254502     5.21   0.000     .4079748    .8997912
recode_B121R5v2 |   .4391081   .1177692     3.73   0.000     .2082561    .6699601
 captiation_use |  -.3174945   .1877151    -1.69   0.091    -.6854549    .0504659
 recode_B122R4A |   .8011947   .1247985     6.42   0.000     .5565639    1.045826
 recode_B122R4B |   .8365644    .132274     6.32   0.000     .5772799    1.095849
recode_B122R11F |   1.130501   .3070353     3.68   0.000      .528648    1.732353
recode_B122R11G |   2.748152   .2464089    11.15   0.000     2.265139    3.231164
         B126R1 |   2.135838   .1676183    12.74   0.000     1.807271    2.464404
recode_B127R1v1 |   1.021465   .1498378     6.82   0.000     .7277521    1.315178
          _cons |   22.64591   .5858206    38.66   0.000     21.49758    23.79424
---------------------------------------------------------------------------------



*/


** Unadjusted Model 5:
regress total50 recode_B4R10Bv1 recode_B4R10Bv2 recode_B121R7 /*recode_B121R1v1*/ /*recode_B121R4v2*/ /*som_DHOonly recode_B121R4v1*/ som_dhoandphc recode_B121R5v2 /*captiation_use*/ /*captiation_use2*/ recode_B122R4A recode_B122R4B recode_B122R11F recode_B122R11G B126R1 recode_B127R1v1 // Take out captiation_use
estat ic
/*

      Source |       SS           df       MS      Number of obs   =     9,797
-------------+----------------------------------   F(11, 9785)     =    109.29
       Model |  35832.8843        11  3257.53494   Prob > F        =    0.0000
    Residual |  291650.418     9,785  29.8058679   R-squared       =    0.1094
-------------+----------------------------------   Adj R-squared   =    0.1084
       Total |  327483.302     9,796  33.4303085   Root MSE        =    5.4595

---------------------------------------------------------------------------------
     total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
----------------+----------------------------------------------------------------
recode_B4R10Bv1 |   1.471657   .5954833     2.47   0.013     .3043868    2.638927
recode_B4R10Bv2 |   1.274526   .2959309     4.31   0.000     .6944408    1.854612
  recode_B121R7 |   .5804167   .1293377     4.49   0.000     .3268881    .8339453
  som_dhoandphc |   .6385257    .125133     5.10   0.000     .3932391    .8838122
recode_B121R5v2 |   .4329972    .117725     3.68   0.000     .2022319    .6637625
 recode_B122R4A |   .7324012   .1179957     6.21   0.000     .5011053    .9636972
 recode_B122R4B |    .746304   .1210427     6.17   0.000     .5090353    .9835727
recode_B122R11F |   1.125911   .3070525     3.67   0.000     .5240245    1.727797
recode_B122R11G |   2.753424   .2464126    11.17   0.000     2.270404    3.236444
         B126R1 |   2.137036   .1676327    12.75   0.000     1.808442    2.465631
recode_B127R1v1 |   1.011387   .1497336     6.75   0.000     .7178785    1.304896
          _cons |   22.47352   .5769408    38.95   0.000      21.3426    23.60444
---------------------------------------------------------------------------------

. estat ic

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      9,797  -31091.94   -30524.3      12    61072.6   61158.88
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.


*/

** Give prefix to selected variables
foreach var of varlist recode_B4R10Bv1 recode_B4R10Bv2 recode_B121R7 /*recode_B121R1v1*/ /*recode_B121R4v2*/ /*som_DHOonly recode_B121R4v1*/ som_dhoandphc recode_B121R5v2 /*captiation_use*/ /*captiation_use2*/ recode_B122R4A recode_B122R4B recode_B122R11F recode_B122R11G B126R1 recode_B127R1v1   {
rename `var' m5_`var'
}

** DHO level
*--------------------------------------------------------------------

** Tabulate all variables
tab1  dho_recode_B62R1v1-dho_recode_B65R8v2,m // no missings


gen recode_dho_best_leadtime = 0, a(dho_best_leadtime)
replace recode_dho_best_leadtime = 1 if dho_best_leadtime  >1


** Correlation matrix for all variables
pwcorr dho_recode_B62R1v1 dho_recoded_B662R19AK2 dho_recoded_B662R19BK2 dho_recoded_B662R19CK2 dho_recode_B65R8v1 dho_recode_B65R8v2 recode_dho_best_leadtime // No issues

/*
             | dho~R1v1 dho_~AK2 dho_~BK2 dho_~CK2 dho_~8v1 dho_r~v2 recod~me
-------------+---------------------------------------------------------------
dho_rec~R1v1 |   1.0000 
dho_reco~AK2 |   0.5915   1.0000 
dho_reco~BK2 |   0.1524   0.1210   1.0000 
dho_reco~CK2 |   0.1131   0.2095  -0.1448   1.0000 
dho_reco~8v1 |   0.1871   0.1655   0.0912  -0.0331   1.0000 
dho_recod~v2 |   0.0749   0.0747  -0.0221  -0.0085   0.3223   1.0000 
recode_dho~e |  -0.2970  -0.3347  -0.0477   0.2101  -0.1118  -0.0203   1.0000 


*/

** Linear regression
** Unadjusted model 5 DHO
regress total50 dho_recode_B62R1v1 dho_recoded_B662R19AK2 dho_recoded_B662R19BK2 dho_recoded_B662R19CK2 dho_recode_B65R8v1 dho_recode_B65R8v2 recode_dho_best_leadtime  // 
estat ic
/*



      Source |       SS           df       MS      Number of obs   =     9,831
-------------+----------------------------------   F(7, 9823)      =     34.49
       Model |  7862.02537         7  1123.14648   Prob > F        =    0.0000
    Residual |  319895.903     9,823  32.5660087   R-squared       =    0.0240
-------------+----------------------------------   Adj R-squared   =    0.0233
       Total |  327757.929     9,830  33.3426174   Root MSE        =    5.7067

------------------------------------------------------------------------------------------
              total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------------------+----------------------------------------------------------------
      dho_recode_B62R1v1 |  -2.192754   .4370126    -5.02   0.000    -3.049388   -1.336119
  dho_recoded_B662R19AK2 |   2.269413   .3187163     7.12   0.000     1.644664    2.894163
  dho_recoded_B662R19BK2 |    .704424   .1198364     5.88   0.000       .46952     .939328
  dho_recoded_B662R19CK2 |   1.075067   .1261785     8.52   0.000     .8277315    1.322403
      dho_recode_B65R8v1 |   .9626311   .2789704     3.45   0.001     .4157917     1.50947
      dho_recode_B65R8v2 |  -.5060587   .1280191    -3.95   0.000    -.7570023    -.255115
recode_dho_best_leadtime |   .6658721    .151981     4.38   0.000     .3679582     .963786
                   _cons |   31.48178   .4204758    74.87   0.000     30.65756    32.30599
------------------------------------------------------------------------------------------

. estat ic

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      9,831  -31186.94  -31067.59       8   62151.18   62208.73
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.

*/


** Give prefix to selected variables
foreach var of varlist dho_recode_B62R1v1 dho_recoded_B662R19AK2 dho_recoded_B662R19BK2 dho_recoded_B662R19CK2 dho_recode_B65R8v1 dho_recode_B65R8v2 recode_dho_best_leadtime {
rename `var' dho_m5_`var'
}


*-------------------------------------------------------------------*
** Dimension Model 6: DHO medicines availability
*-------------------------------------------------------------------*

** Tabulate
ta dho_med50,m // no missing

** Linear regression
regress total50 dho_med50
estat ic
/*

      Source |       SS           df       MS      Number of obs   =     9,831
-------------+----------------------------------   F(1, 9829)      =    515.69
       Model |  16338.8351         1  16338.8351   Prob > F        =    0.0000
    Residual |  311419.094     9,829  31.6837007   R-squared       =    0.0499
-------------+----------------------------------   Adj R-squared   =    0.0498
       Total |  327757.929     9,830  33.3426174   Root MSE        =    5.6288

------------------------------------------------------------------------------
  total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
   dho_med50 |   .1453385   .0064001    22.71   0.000     .1327929     .157884
       _cons |   27.82233   .2368476   117.47   0.000     27.35806     28.2866
------------------------------------------------------------------------------

. estat ic

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      9,831  -31186.94  -30935.58       2   61875.16   61889.55

*/

rename dho_med50 dho_m6_med50

*-------------------------------------------------------------------*
** Dimension Model 7: Accessibility
*-------------------------------------------------------------------*

** Tabulate all relevant data
tab1 recode_B3R6V2 pulau ficalcapacity dho_areatype ,m
sum DC_distance_m PC_distance_m PHC_distance_m,d

** Make distances quartiles
egen DC_distance_q4 = xtile(DC_distance_m), nquantiles(4)
egen PC_distance_q4 = xtile(PC_distance_m), nquantiles(4)
egen PHC_distance_q4 = xtile(PHC_distance_m), nquantiles(4)

** Rescale to km

gen DC_distance_km = DC_distance_m/1000
gen PC_distance_km = PC_distance_m/1000
gen PHC_distance_km = PHC_distance_m/1000


*-------------------------------------------------------------------*
**Modify 
*-------------------------------------------------------------------*


*PHO level
pwcorr total50 recode_B3R6V2 DC_distance_km PC_distance_km PHC_distance_km // high corelates between DC_distance_km and PHC_distance_km

/*


             | total5~d recod~V2 DC_di~km PC_di~km PHC_d~km
-------------+---------------------------------------------
  total50med |   1.0000 
recode_B3R~2 |   0.1283   1.0000 
DC_distan~km |  -0.0305  -0.1175   1.0000 
PC_distan~km |  -0.1130  -0.3412   0.6966   1.0000 
PHC_dista~km |  -0.0123  -0.0258   0.9772   0.6574   1.0000 



*/
regress total50 i.recode_B3R6V2 DC_distance_km PC_distance_km PHC_distance_km // remove DC_distance_km

/*

--------------------------------------------------------------------------------
    total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
---------------+----------------------------------------------------------------
 recode_B3R6V2 |
        Rural  |   1.901994   .1557706    12.21   0.000     1.596652    2.207337
        Urban  |   1.708931   .1739617     9.82   0.000     1.367931    2.049932
               |
DC_distance_km |   .0042802   .0009564     4.48   0.000     .0024054    .0061549
PC_distance_km |   -.005067   .0006719    -7.54   0.000     -.006384   -.0037499
         _cons |    32.0917   .1613667   198.87   0.000     31.77539    32.40801
--------------------------------------------------------------------------------

*/

regress total50 i.recode_B3R6V2 /*DC_distance_km*/ PC_distance_km PHC_distance_km //allgoods

/*

     total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
----------------+----------------------------------------------------------------
  recode_B3R6V2 |
         Rural  |   1.828459    .158178    11.56   0.000     1.518398     2.13852
         Urban  |   1.596757   .1785783     8.94   0.000     1.246707    1.946808
                |
 PC_distance_km |  -.0052234   .0006615    -7.90   0.000    -.0065202   -.0039267
PHC_distance_km |   .0047852   .0009648     4.96   0.000      .002894    .0066764
          _cons |   32.23432   .1705811   188.97   0.000     31.89994    32.56869

*/

** Give prefix to selected variables
foreach var of varlist recode_B3R6V2 PC_distance_km PHC_distance_km {
rename `var' m7_`var'
}


** Accessibility and demographical factors at district level


gen recode_percentage_APBDP_health = percentage_APBDP_health, a(percentage_APBDP_health)
replace recode_percentage_APBDP_health = percentage_APBDP_healt
replace recode_percentage_APBDP_health = 0 if recode_percentage_APBDP_health ==. 

** Correlation matrix for all variables

pwcorr NPopulat pctPBI2019 NAPBDD_t recode_percentage_APBDP_health ficalcapacity  areatype  access_ad_dist  pulau  // No issues

/*

             | NPopulat pct~2019 NAPBDD_t recode~h ficalc~y areatype access..
-------------+---------------------------------------------------------------
    NPopulat |   1.0000 
  pctPBI2019 |  -0.3328   1.0000 
    NAPBDD_t |   0.7091  -0.0574   1.0000 
recode_per~h |  -0.0211   0.2389   0.1779   1.0000 
ficalcapac~y |   0.6706  -0.3658   0.6337  -0.0922   1.0000 
    areatype |   0.1457  -0.6086  -0.1453  -0.1393   0.1925   1.0000 
access_ad_~t |   0.5663  -0.3818   0.2790   0.1073   0.3228   0.2901   1.0000 
       pulau |  -0.3118   0.2484  -0.2767  -0.0059  -0.2842  -0.1133  -0.3691 

             |    pulau
-------------+---------
       pulau |   1.0000 

	*/

regress total50 i.NPopulat pctPBI2019 i.NAPBDD_t recode_percentage_APBDP_health i.ficalcapacity  areatype  access_ad_dist  pulau // take out NPopulat


/*


                    total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------------------------+----------------------------------------------------------------
                      NPopulat |
                            2  |   .7708758   .2465567     3.13   0.002      .287574    1.254178
                            3  |   .1341921   .2597503     0.52   0.605    -.3749719    .6433562
                            4  |  -.1513093   .2846499    -0.53   0.595    -.7092817    .4066631
                            5  |   .6649584   .3123013     2.13   0.033     .0527837    1.277133
                               |
                    pctPBI2019 |  -.0159268   .0041189    -3.87   0.000    -.0240007   -.0078529
                               |
                      NAPBDD_t |
                            2  |   .6834749   .2442579     2.80   0.005     .2046793    1.162271
                            3  |   .8611831   .2535382     3.40   0.001      .364196     1.35817
                            4  |   2.193136   .2739355     8.01   0.000     1.656166    2.730106
                            5  |   .6684623   .2885221     2.32   0.021     .1028996    1.234025
                               |
recode_percentage_APBDP_health |   .0195138   .0118075     1.65   0.098    -.0036314    .0426589
                               |
                 ficalcapacity |
                       Medium  |   1.036858   .1716223     6.04   0.000     .7004431    1.373273
           High and Very High  |   .5348784   .2068271     2.59   0.010     .1294547    .9403021
                               |
                      areatype |  -1.240642   .1969995    -6.30   0.000    -1.626802   -.8544824
            access_ad_district |   .0552719   .0032966    16.77   0.000     .0488099    .0617339
                         pulau |   .4453532   .1893653     2.35   0.019     .0741582    .8165481
                         _cons |   27.57636   .4373109    63.06   0.000     26.71914    28.43358

*/

regress total50 /*i.NPopulat*/ pctPBI2019 i.NAPBDD_t recode_percentage_APBDP_health i.ficalcapacity areatype access_ad_dist pulau // take out  recode_percentage_APBDP_health
/*

------------------------------------------------------------------------------------------------
                    total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-------------------------------+----------------------------------------------------------------
                    pctPBI2019 |   -.015879   .0041031    -3.87   0.000    -.0239219   -.0078361
                               |
                      NAPBDD_t |
                            2  |    .713081    .228111     3.13   0.002     .2659364    1.160226
                            3  |   .7024434   .2239252     3.14   0.002     .2635039    1.141383
                            4  |   1.877802   .2296563     8.18   0.000     1.427629    2.327976
                            5  |    .794881   .2453341     3.24   0.001     .3139756    1.275786
                               |
recode_percentage_APBDP_health |   .0180813   .0114223     1.58   0.113    -.0043088    .0404713
                               |
                 ficalcapacity |
                       Medium  |   1.083817   .1687488     6.42   0.000     .7530351      1.4146
           High and Very High  |   .6579128   .1998998     3.29   0.001     .2660681    1.049758
                               |
                      areatype |  -1.206908   .1965155    -6.14   0.000    -1.592118   -.8216969
            access_ad_district |   .0568008   .0028957    19.62   0.000     .0511245     .062477
                         pulau |   .4907673   .1878051     2.61   0.009     .1226306     .858904
                         _cons |   27.77398   .4343137    63.95   0.000     26.92264    28.62533

*/
regress total50 /*i.NPopulat*/ pctPBI2019 i.NAPBDD_t /*recode_percentage_APBDP_health*/ i.ficalcapacity i.areatype access_ad_dist  pulau // perfect 

/*


-------------------------------------------------------------------------------------
         total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
--------------------+----------------------------------------------------------------
         pctPBI2019 |  -.0144606   .0040044    -3.61   0.000      -.02231   -.0066112
                    |
           NAPBDD_t |
                 2  |   .7958861   .2220493     3.58   0.000     .3606238    1.231148
                 3  |   .7885849   .2172291     3.63   0.000     .3627713    1.214399
                 4  |    1.95975   .2237627     8.76   0.000     1.521129    2.398371
                 5  |    .900196   .2361592     3.81   0.000     .4372754    1.363117
                    |
      ficalcapacity |
            Medium  |   1.075248   .1686749     6.37   0.000     .7446101    1.405885
High and Very High  |   .6131464   .1979045     3.10   0.002     .2252129     1.00108
                    |
           areatype |  -1.184601   .1960246    -6.04   0.000    -1.568849    -.800352
 access_ad_district |   .0576923   .0028407    20.31   0.000      .052124    .0632605
              pulau |   .4989629   .1877482     2.66   0.008     .1309379    .8669879
              _cons |   27.81217   .4336763    64.13   0.000     26.96208    28.66227
-------------------------------------------------------------------------------------


*/


** Give prefix to selected variables
foreach var of varlist  /*i.NPopulat*/ pctPBI2019 NAPBDD_t /*recode_percentage_APBDP_health*/ ficalcapacity areatype access_ad_dist pulau {
rename `var' dho_m7_`var'
}


** Accessibility and demographical factors at provincial level

gen recode_prov_idx_num = prov_idx_num, a(prov_idx_num)
replace recode_prov_idx_num = 0 if prov_idx_num <2
replace recode_prov_idx_num = 1 if prov_idx_num ==2
replace recode_prov_idx_num = 2 if prov_idx_num >2


pwcorr n_prov_popul prov_percent_popu Percentase_APBDkesehatan n_prov_APBDtotal recode_prov_idx_num access_ad_provincial islands 

regress total50 i.n_prov_popul prov_percent_popu Percentase_APBDkesehatan i.n_prov_APBDtotal i.recode_prov_idx_num access_ad_provincial i.islands 

regress total50 i.n_prov_popul prov_percent_popu Percentase_APBDkesehatan /*i.n_prov_APBDtotal*/ i.recode_prov_idx_num access_ad_provincial i.islands 

regress total50 /*i.n_prov_popul*/ prov_percent_popu Percentase_APBDkesehatan/*i.n_prov_APBDtotal*/ i.recode_prov_idx_num access_ad_provincial i.islands 

regress total50 /*i.n_prov_popul*/ prov_percent_popu Percentase_APBDkesehatan/*i.n_prov_APBDtotal*/ i.recode_prov_idx_num /*access_ad_provincial*/ i.islands 


** Give prefix to selected variables
foreach var of varlist  /*i.n_prov_popul*/ prov_percent_popu Percentase_APBDkesehatan/*i.n_prov_APBDtotal*/ recode_prov_idx_num /*access_ad_provincial*/ islands  {
rename `var' pro_m7_`var'
}


dtable i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan i.m1* i.m2* i.m3*  i.m5* i.dho_m1* i.dho_m2* i.dho_m5* dho_m6*, export("C:\Users\79952rfa\OneDrive - Erasmus University Rotterdam\Local Pharmaceutical System\Manuscript 4 - Multilevel Analyses\Indonesia meds availability\Testt\3.Output\descriptivetable3.docx", as(docx) replace)



*-------------------------------------------------------------------*
**Multilevel analyses
*-------------------------------------------------------------------*


*-------------------------------------------------------------------*
** Full Model 2: Account for clustering on District level
*-------------------------------------------------------------------*

* Puskesmas only
*-------------------------------------------------------------------*


regress total50 m1* m2* m3* m5* , vce( cluster  districtid)  // R-squared: 17,6%
estat vce
estat ic // AIC:  60320

** Predict residuals
predict fm2_resid, resid
predict fm2_outc

* DHO 
*-------------------------------------------------------------------*
regress total50  dho_m1* dho_m2* dho_m5* dho_m6*, vce( cluster  districtid)  // R-squared: 8.8
estat ic // AIC: 61490

* Accessibility at PHC level
*-------------------------------------------------------------------*

regress total50 m7* , vce( cluster  districtid)  // R-squared: 2.5 %
estat vce
estat ic // AIC:  62130


** Predict residuals
predict fm3_resid, resid
predict fm3_outc

* Accessibility at DHO level
*-------------------------------------------------------------------*
regress total50 dho_m7* , vce( cluster  districtid)  // R-squared: 6.9%
estat vce
estat ic // AIC:  61687


** Predict residuals
predict fm4_resid, resid
predict fm4_outc


* Accessibility at Provincial level
*-------------------------------------------------------------------*

regress total50 pro_m7* , vce( cluster  districtid)  // R-squared: 6.9%
estat vce
estat ic // AIC:   61684

** Predict residuals
predict fm5_resid, resid
predict fm5_outc


* Accessibility at PHC and DHO levels
*-------------------------------------------------------------------*
regress total50 m7* dho_m7* , vce( cluster  districtid)  // R-squared: 7.0%
estat vce
estat ic // AIC ; 61678

** Predict residuals
predict fm6_resid, resid
predict fm6_outc

* Accessibility at PHC, DHO and provincial levels
*-------------------------------------------------------------------*
regress total50 m7* dho_m7* pro_m7*, vce( cluster  districtid)  // R-squared: 9.1%
estat vce
estat ic // AIC ; 61466

** Predict residuals
predict fm7_resid, resid
predict fm7_outc


* PHC, DHO and Accessibility at PHC, DHO and provincial levels
*-------------------------------------------------------------------*

regress total50  m1* m2* m3* m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan, vce( cluster  districtid)  // R-squared: 25.4%
estat vce
estat ic // AIC: 59411



*-------------------------------------------------------------------*
** Full Model 3: Random Intercept on District level
*-------------------------------------------------------------------*

* Puskesmas only
*-------------------------------------------------------------------*


** Predict residuals
predict mfm3_resid, resid
predict mfm3_outc

* Puskesmas and DHO 
*-------------------------------------------------------------------*

** Multilevel random intercept on district id
mixed  total50 m1* m2* m3* m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan|| districtid: //
estimates store dhoml1
estat ic // AIC: 57931

** Predict residuals
predict fm4_dho_resid, resid
predict fm4_dho_outc

xtmixed  total50 m1* m2* m3* m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || districtid: // r-squared : 27.4
mltrsq
estat ic // AIC : 57931


*-------------------------------------------------------------------*
** Full Model 4: Random Intercept on District level & Provincial level
*-------------------------------------------------------------------*

** Extract province codes from district ID"
tostring districtid, gen(districtid_text)
gen provid = substr(districtid_text,1,2) 
codebook provid // 34 unique,
destring provid, replace

* Puskesmas only
*-------------------------------------------------------------------*

** Multilevel random intercept on district id
mixed  total50 m1* m2* m3* m5* || provid: || districtid: 
estimates store ml2
estat ic // AIC: 60126

** Predict residuals
predict fm41_resid, resid
predict fm41_outc


d $outPATH
regsave using fullmodel_mixed_med50.dta, replace pval ci


** Predict residuals
predict fm42_dho_resid, resid
predict fm42_dho_outc

** Histogram of residuals
cd $outPATH
hist fm42_dho_resid
graph export "Histogram_resid_ml.png", replace

scatter fm42_dho_resid fm4_dho_outc
graph export "resid_predict_ml.png", replace

scatter total50med fm42_dho_outc
graph export "obs_predict_ml.png", replace


** save dataset
cd $outPATH
save _temp_dataset_med50.dta, replace

*-------------------------------------------------------------------*
** Spatial autocorelation analyses
*-------------------------------------------------------------------*

**-------------------------------------------------------------------*
** Full Model 5: Spatial lags
*-------------------------------------------------------------------*

** Import spatial lag variables
cd $path
import delimited "Spatial lags 50med.csv", clear

** Keep relevant variables and save as dta
keep b1r5 total50med_10km total50med_nn2
rename b1r5 B1R5

** save
save spatiallags50med.dta, replace

**Import data
cd $outPATH
use _temp_dataset_med50.dta, clear

** Merge with spatial lags
cd $path
merge 1:1 B1R5 using spatiallags50med
drop if _merge ==1
drop _merge

** Combine spatial lag of 10km with nn2 
gen totalmed50_10kmnn2 = total50med_10km
replace totalmed50_10kmnn2 = total50med_nn2 if total50med_10km ==.

** Model without random effects, with spatial lag included: 10km or 2 nearest neignb
** Note: based on Geoda, this spatial lag overcorrects (from clustering to dispersion)
regress total50med m1* m2* m3* m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan  totalmed50_10kmnn2 // R-squared: 30,1%
estat ic // 58714


/*
 
      Source |       SS           df       MS      Number of obs   =     9,794
-------------+----------------------------------   F(59, 9734)     =     72.53
       Model |  99957.4593        59  1694.19422   Prob > F        =    0.0000
    Residual |  227363.322     9,734  23.3576455   R-squared       =    0.3054
-------------+----------------------------------   Adj R-squared   =    0.3012
       Total |  327320.781     9,793  33.4239539   Root MSE        =     4.833

----------------------------------------------------------------------------------------------------------
                              total50med | Coefficient  Std. err.      t    P>|t|     [95% conf. interval]
-----------------------------------------+----------------------------------------------------------------
                 m1_recode_B8R1K3_14_ori |   1.028714   .1250901     8.22   0.000     .7835119    1.273917
                    m1_recode_B122R11Cv1 |  -.0997396   .4074905    -0.24   0.807    -.8985056    .6990264
                    m1_recode_B122R11Cv2 |  -.1576526   .1067406    -1.48   0.140    -.3668863    .0515811
                    m1_recode_B122R11Bv1 |   .4610007   .2229832     2.07   0.039     .0239073    .8980941
                       m1_recode_B126R4B |   .4211725   .1932097     2.18   0.029     .0424413    .7999038
                       m1_recode_B126R4C |   .4025924   .2190102     1.84   0.066     -.026713    .8318978
                                 m1_B3R3 |   1.453712   .1093381    13.30   0.000     1.239387    1.668038
                                 m1_B3R8 |    .759945    .141515     5.37   0.000     .4825462    1.037344
              m2_recode_B13R2BTERSEDIAv1 |  -.1159934   .1094755    -1.06   0.289    -.3305881    .0986014
              m2_recode_B13R2CTERSEDIAv1 |   .2403085   .1273798     1.89   0.059    -.0093824    .4899994
              m2_recode_B13R2ETERSEDIAv1 |   .2638846   .1283418     2.06   0.040      .012308    .5154612
                                m2_B3R10 |      .2183   .1200725     1.82   0.069    -.0170671     .453667
                             m3_e_simpus |   -.067955   .1837169    -0.37   0.711    -.4280782    .2921683
                            m3_ol_simpus |   .1727396   .1919657     0.90   0.368    -.2035531    .5490324
                      m5_recode_B127R1v1 |    .480886   .1355148     3.55   0.000     .2152489    .7465231
                      m5_recode_B4R10Bv1 |   1.695638   .5294722     3.20   0.001      .657763    2.733514
                      m5_recode_B4R10Bv2 |   .3480794   .2655404     1.31   0.190    -.1724351    .8685938
                        m5_recode_B121R7 |   .2012888   .1172719     1.72   0.086    -.0285886    .4311661
                        m5_som_dhoandphc |   .3087817   .1137788     2.71   0.007     .0857516    .5318118
                      m5_recode_B121R5v2 |   .2688708   .1054638     2.55   0.011     .0621399    .4756016
                       m5_recode_B122R4A |   .2627022   .1142772     2.30   0.022     .0386953    .4867092
                       m5_recode_B122R4B |   .5140162   .1094463     4.70   0.000     .2994787    .7285538
                      m5_recode_B122R11F |   .3648142   .3320404     1.10   0.272    -.2860539    1.015682
                      m5_recode_B122R11G |   1.665315   .2341154     7.11   0.000       1.2064     2.12423
                               m5_B126R1 |   .8787716   .1582245     5.55   0.000     .5686186    1.188924
         dho_m1_dho_ideal_PIC_pharmacist |  -.1136398   .1348109    -0.84   0.399    -.3778973    .1506176
          dho_m2_dho_recode_B662R12AK1v1 |   .1079007   .2814988     0.38   0.702    -.4438955    .6596968
          dho_m2_dho_recode_B662R12BK1v1 |    .692958   .1654157     4.19   0.000     .3687089    1.017207
          dho_m2_dho_recode_B662R12CK1v1 |  -.1823319   .1145174    -1.59   0.111    -.4068099     .042146
         dho_m5_recode_dho_best_leadtime |   .2743294   .1335632     2.05   0.040     .0125178    .5361411
               dho_m5_dho_recode_B62R1v1 |  -2.455375   .4477627    -5.48   0.000    -3.333083   -1.577667
           dho_m5_dho_recoded_B662R19AK2 |  -1.857557   .3201457    -5.80   0.000    -2.485109   -1.230005
           dho_m5_dho_recoded_B662R19BK2 |   .2662084   .1128057     2.36   0.018     .0450858    .4873309
           dho_m5_dho_recoded_B662R19CK2 |   .2872428   .1120877     2.56   0.010     .0675276     .506958
               dho_m5_dho_recode_B65R8v1 |   .4162072   .2469333     1.69   0.092    -.0678333    .9002477
               dho_m5_dho_recode_B65R8v2 |  -.0297307   .1151016    -0.26   0.796    -.2553536    .1958923
                            dho_m6_med50 |   .1373466   .0084213    16.31   0.000     .1208392    .1538541
                                         |
                        m7_recode_B3R6V2 |
                                  Rural  |    .119676    .156526     0.76   0.445    -.1871476    .4264995
                                  Urban  |    .409637   .1933864     2.12   0.034     .0305595    .7887144
                                         |
                       m7_PC_distance_km |   .0005524   .0007325     0.75   0.451    -.0008836    .0019883
                      m7_PHC_distance_km |    .020556   .0070668     2.91   0.004     .0067036    .0344084
                                         |
                         dho_m7_areatype |
                                   City  |  -.3767474   .2055969    -1.83   0.067    -.7797601    .0262653
                       dho_m7_pctPBI2019 |   .0010451   .0042251     0.25   0.805     -.007237    .0093272
                                         |
                         dho_m7_NAPBDD_t |
                                      2  |   .2068807   .2093848     0.99   0.323     -.203557    .6173184
                                      3  |   .0398458   .2085156     0.19   0.848     -.368888    .4485796
                                      4  |   .3340945   .2236756     1.49   0.135    -.1043561    .7725452
                                      5  |  -.6441192   .2568279    -2.51   0.012    -1.147555   -.1406832
                                         |
               dho_m7_access_ad_district |   .0021714   .0040148     0.54   0.589    -.0056984    .0100413
                                         |
                            dho_m7_pulau |
                                    Yes  |  -.4794858   .1847881    -2.59   0.009    -.8417088   -.1172627
                                         |
                    dho_m7_ficalcapacity |
                                 Medium  |   .3034223   .1575217     1.93   0.054    -.0053529    .6121975
                     High and Very High  |   .5115938    .194851     2.63   0.009     .1296454    .8935422
                                         |
              pro_m7_recode_prov_idx_num |
                                      1  |  -.3432377   .1543404    -2.22   0.026     -.645777   -.0406984
                                      2  |  -.2834427   .1647812    -1.72   0.085     -.606448    .0395627
                                         |
                          pro_m7_islands |
                               Sumatera  |  -.2411942   .2699439    -0.89   0.372    -.7703403    .2879519
Borneo, West Nusa Tenggara and Sulawesi  |  -.3058043   .2441291    -1.25   0.210    -.7843481    .1727394
                          Java and Bali  |   .1658521   .3186977     0.52   0.603    -.4588616    .7905658
                                         |
                pro_m7_prov_percent_popu |  -.0247219   .0055994    -4.42   0.000    -.0356978    -.013746
         pro_m7_Percentase_APBDkesehatan |   .0098639   .0157965     0.62   0.532    -.0211005    .0408282
                      totalmed50_10kmnn2 |   .3394147   .0128534    26.41   0.000     .3142193    .3646101
                                   _cons |   12.02408   .9076927    13.25   0.000     10.24481    13.80334
----------------------------------------------------------------------------------------------------------

. estat ic // 58762

Akaike's information criterion and Bayesian information criterion

-----------------------------------------------------------------------------
       Model |          N   ll(null)  ll(model)      df        AIC        BIC
-------------+---------------------------------------------------------------
           . |      9,794  -31081.49  -29297.07      60   58714.14   59145.51
-----------------------------------------------------------------------------
Note: BIC uses N = number of observations. See [R] IC note.


*/
** Predict residuals
predict fm5_dho_resid, resid
predict fm5_dho_outc

** Model without random effects, with spatial lag included: 2 nn
** Note: based on Geoda, this model acocunts for all spatial variation
regress total50med m1* m2* m3* m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.9
estat ic //  58748
cd $outPATH
regsave using fullmodel_lagnn2_50med.dta, replace pval ci

** Predict residuals
predict fm6_dho_resid, resid
predict fm6_dho_outc

** Histogram of residuals
cd $outPATH
hist fm6_dho_resid
graph export "Histogram_resid_nn2.png", replace

scatter fm4_dho_resid fm6_dho_outc
graph export "resid_predict_nn2.png", replace

scatter total50med fm6_dho_outc
graph export "obs_predict_nn2.png", replace



*-------------------------------------------------------------------*
** Create Outputs - Multilevel model - inspecting AIC 
*-------------------------------------------------------------------*

** Normal regression 
*-------------------------------------------------------------------*

**Checking the individual dimension contribution to medicine availability\Testt\1

*Normal model
**PHC
xtmixed total50med m1* 
estat ic // AIC: 61055

xtmixed total50med m2* 
estat ic // AIC: 61607

xtmixed total50med m3* 
estat ic // AIC: 62207

xtmixed total50med m5* 
estat ic // AIC: 61069
*DHO 

xtmixed total50med dho_m1* 
estat ic // AIC: 62359

xtmixed total50med dho_m2* 
estat ic // AIC: 62190

xtmixed total50med dho_m5* 
estat ic // AIC: 62147

xtmixed total50med dho_m6* 
estat ic // AIC: 61871


*Multilevel clusted with district id
**PHC
xtmixed total50med m1* || districtid:
estat ic // AIC: 58505

xtmixed total50med m2* || districtid:
estat ic // AIC: 58956

xtmixed total50med m3* || districtid:
estat ic // AIC: 59086

xtmixed total50med m5* || districtid:
estat ic // AIC: 58480

*DHO 

xtmixed total50med dho_m1* || districtid:
estat ic // AIC: 59095

xtmixed total50med dho_m2* || districtid:
estat ic // AIC: 59082

xtmixed total50med dho_m5* || districtid:
estat ic // AIC:  59062

xtmixed total50med dho_m6* || districtid:
estat ic // AIC: 58998


*Multilevel clusted with provindical id and district id
**PHC
xtmixed total50med m1* || provid: || districtid: 
estat ic // AIC: 58505

xtmixed total50med m2* || provid: || districtid: 
estat ic // AIC: 58956

xtmixed total50med m3* || provid: || districtid: 
estat ic // AIC: 59085

xtmixed total50med m5* || provid: || districtid: 
estat ic // AIC: 58480

*DHO 

xtmixed total50med dho_m1* || provid: || districtid: 
estat ic // AIC: 59095

xtmixed total50med dho_m2* || provid: || districtid: 
estat ic // AIC: 59082

xtmixed total50med dho_m5* || provid: || districtid: 
estat ic // AIC:  59062

xtmixed total50med dho_m6* || provid: || districtid: 
estat ic // AIC: 58998



*basic model 
xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5*
estat ic //AIC :60298


xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* || districtid:
mltrsq // R-square : 26.8
estat ic // AIC : 57922

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 57913

*** Individual element association

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km || provid: ||districtid:
estat ic // AIC : 58992

xtmixed total50med i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  || provid: ||districtid:
estat ic // AIC : 58940

xtmixed total50med i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 58958

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 58910

xtmixed total50med m1*   || provid: ||districtid:
estat ic // AIC : 58417

xtmixed total50med m2*   || provid: ||districtid:
estat ic // AIC : 58871

xtmixed total50med  m3*   || provid: ||districtid:
estat ic // AIC : 58959

xtmixed total50med  m5*  || provid: ||districtid:
estat ic // AIC : 58396

xtmixed total50med m1* m2* m3* m5*  || provid: ||districtid:
estat ic // AIC : 58902

xtmixed total50med dho_m1* || provid: ||districtid:
estat ic // AIC : 58964

xtmixed total50med dho_m2* || provid: ||districtid:
estat ic // AIC : 58961

xtmixed total50med dho_m5*  || provid: ||districtid:
estat ic // AIC : 58952

xtmixed total50med  dho_m6* || provid: ||districtid:
estat ic // AIC : 58854

xtmixed total50med dho_m1* dho_m2* dho_m5* dho_m6* || provid: ||districtid:
estat ic // AIC : 58863

xtmixed total50med m1* m2* m3* m5*  dho_m1* dho_m2* dho_m5* dho_m6* || provid: ||districtid:
estat ic // AIC : 57914


*** Excluding Individual element in full model association - Model 1

xtmixed total50med /*i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km8*/ m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 57917

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km /*m1* m2* m3* m5**/ i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 58804

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* /*i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity*/ dho_m1* dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 57911

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity /*dho_m1* dho_m2* dho_m5* dho_m6**/ i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 58016

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* /*i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan*/ || provid: ||districtid:
estat ic // AIC : 57907

*** model 1
xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km /*m1**/ m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 58217

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* /*m2**/ m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 57933

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* /*m3**/ m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 57912

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* /*m5**/ i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 58262

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity /*dho_m1**/ dho_m2* dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 57911

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* /*dho_m2**/ dho_m5* dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 57913

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* /*dho_m5**/ dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 57922

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5* /*dho_m6**/ i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan || provid: ||districtid:
estat ic // AIC : 58028


** reorder the variables

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* m3* m5* dho_m1* dho_m2* dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 57913

*** model 2 counting geographichal factors excluding one by one - Excluding dho_m1*


xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan /*m1**/ m2* m3* m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 58125

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* /*m2**/ m3* m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 57931

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 57911.1

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* m3* /*m5**/ /*dho_m1**/ dho_m2* dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 58260

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* m3* m5* /*dho_m1**/ /*dho_m2**/ dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 57911.7

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* m3* m5* /*dho_m1**/ dho_m2* /*dho_m5**/ dho_m6*|| provid: ||districtid:
estat ic // AIC : 57920

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* m3* m5* /*dho_m1**/ dho_m2* dho_m5* /*dho_m6**/|| provid: ||districtid:
estat ic // AIC : 58016

*** model 3 counting geographichal factors excluding one by one - Excluding dho_m1* | m3*

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan /*m1**/ m2* /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 58216

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* /*m2**/ /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 57930.8

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ /*m5**/ /*dho_m1**/ dho_m2* dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 57260

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ m5* /*dho_m1**//*dho_m2**/ dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 57910

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ m5* /*dho_m1**/ dho_m2* /*dho_m5**/ dho_m6*|| provid: ||districtid:
estat ic // AIC : 579119

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* /*dho_m6**/|| provid: ||districtid:
estat ic // AIC : 58016


*** model 4 counting geographichal factors excluding one by one - Excluding dho_m1* | m3* | dho_m2*


xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan /*m1**/ m2* /*m3**/ m5* /*dho_m1**//*dho_m2**/ dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 58215

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* /*m2**/ /*m3**/ m5* /*dho_m1**//*dho_m2**/ dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 57930

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ /*m5**/ /*dho_m1**//*dho_m2**/ dho_m5* dho_m6*|| provid: ||districtid:
estat ic // AIC : 58259

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ m5* /*dho_m1**//*dho_m2**/ /*dho_m5**/ dho_m6*|| provid: ||districtid:
estat ic // AIC : 57919

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ m5* /*dho_m1**//*dho_m2**/ dho_m5* /*dho_m6**/|| provid: ||districtid:
estat ic // AIC : 58019

*** model 5 counting geographichal factors excluding one by one - Excluding dho_m1* | m3* | dho_m2* | dho_m5*


xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan /*m1**/ m2* /*m3**/ m5* /*dho_m1**//*dho_m2**/ /*dho_m5**/ dho_m6*|| provid: ||districtid:
estat ic // AIC : 58221.3

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* /*m2**/ /*m3**/ m5* /*dho_m1**//*dho_m2**/ /*dho_m5**/ dho_m6*|| provid: ||districtid:
estat ic // AIC : 57938

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ /*m5**/ /*dho_m1**//*dho_m2**/ /*dho_m5**/ dho_m6*|| provid: ||districtid:
estat ic // AIC : 58264

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* m2* /*m3**/ m5* /*dho_m1**//*dho_m2**/ /*dho_m5**/ /*dho_m6**/|| provid: ||districtid:
estat ic // AIC : 58028


*** model 6 counting geographichal factors excluding one by one - Excluding dho_m1* | m3* | dho_m2* | dho_m5* |m2*

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan /*m1**/ /*m2**/ /*m3**/ m5* /*dho_m1**//*dho_m2**/ /*dho_m5**/ dho_m6*|| provid: ||districtid:
estat ic // AIC : 58271

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* /*m2**/ /*m3**/ /*m5**/ /*dho_m1**//*dho_m2**/ /*dho_m5**/ dho_m6*|| provid: ||districtid:
estat ic // AIC : 58289

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* /*m2**/ /*m3**/ m5* /*dho_m1**//*dho_m2**/ /*dho_m5**/ /*dho_m6*/|| provid: ||districtid:
estat ic // AIC : 58049

*** model 7 counting geographichal factors excluding one by one - Excluding dho_m1* | m3* | dho_m2* | dho_m5* |m2* | dho_m6*

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan /*m1**/ /*m2**/ /*m3**/ m5* /*dho_m1**//*dho_m2**/ /*dho_m5**/ /*dho_m6*/|| provid: ||districtid:
estat ic // AIC : 58358

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan m1* /*m2**/ /*m3**/ /*m5**/ /*dho_m1**//*dho_m2**/ /*dho_m5**/ /*dho_m6*/|| provid: ||districtid:
estat ic // AIC : 58398

*** model 8 counting geographichal factors excluding one by one - Excluding dho_m1* | m3* | dho_m2* | dho_m5* |m2* | dho_m6* |m5*

xtmixed total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km  i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan /*m1**/ /*m2**/ /*m3**/ /*m5**/ /*dho_m1**//*dho_m2**/ /*dho_m5**/ /*dho_m6*/|| provid: ||districtid:
estat ic // AIC : 58910

*** model 8 counting geographichal factors excluding one by one - Excluding dho_m1* | m3* | dho_m2* | dho_m5* |m2* | dho_m6* |m1* | m5*




*-------------------------------------------------------------------*
** Create Outputs - Spatial autocorellation - inspecting R2
*-------------------------------------------------------------------*

** Normal regression 
*-------------------------------------------------------------------*

**Full model
regress total50med m1* m2* m3* m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.9
estat ic 

*** Individual element association

regress total50med i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km total50med_nn2
estat ic // R-squared : 18.3 %

regress total50med i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity  total50med_nn2
estat ic // R-squared : 19.6 %

regress total50med  i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2
estat ic // R-squared : 19.3%

regress total50med  i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2
estat ic // R-squared : 20.5 %

regress total50med m1*   total50med_nn2
estat ic // R-squared : 24.2 %

regress total50med  m2* total50med_nn2
estat ic // R-squared : 20.0 %

regress total50med   m3*   total50med_nn2
estat ic // R-squared : 17.8 %

regress total50med  m5*  total50med_nn2
estat ic // R-squared : 22.5 %

regress total50med m1* m2* m3* m5* total50med_nn2
estat ic // R-squared : 26.3 %

regress total50med dho_m1* total50med_nn2
estat ic // R-squared : 17.3 %

regress total50med dho_m2* total50med_nn2
estat ic // R-squared : 17.7 %

regress total50med dho_m5*  total50med_nn2
estat ic // R-squared : 17.9 %

regress total50med dho_m6* total50med_nn2
estat ic // R-squared : 18.8 %

regress total50med dho_m1* dho_m2* dho_m5* dho_m6* total50med_nn2
estat ic // R-squared : 20.6 %

regress total50med m1* m2* m3* m5*  dho_m1* dho_m2* dho_m5* dho_m6* total50med_nn2 
estat ic // R-squared : 29.1 %

*** Excluding Individual element in full model association - Model 1 

regress total50med /*m1**/ m2* m3* m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.0
estat ic 

regress total50med m1* /*m2**/ m3* m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.7

regress total50med m1* m2* /*m3**/ m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.8
estat ic 

regress total50med m1* m2* m3* /*m5**/ dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 28.3
estat ic 

regress total50med m1* m2* m3* m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.8
estat ic 

regress total50med m1* m2* m3* m5* dho_m1* /*dho_m2**/ dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.6
estat ic 

regress total50med m1* m2* m3* m5* dho_m1* dho_m2* /*dho_m5**/ dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.0
estat ic 

regress total50med m1* m2* m3* m5* dho_m1* dho_m2* dho_m5* /*dho_m6**/ i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.8
estat ic 

*** model 2 counting geographichal factors excluding one by one - Excluding m3*

regress total50med /*m1**/ m2* /*m3**/ m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.1
estat ic 

regress total50med m1* /*m2**/ /*m3**/ m5* dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.7
estat ic 

regress total50med m1* m2* /*m3**/ /*m5**/ dho_m1* dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 28.3
estat ic 

regress total50med m1* m2* /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.8
estat ic 

regress total50med m1* m2* /*m3**/ m5* dho_m1* /*dho_m2**/ dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.6
estat ic 

regress total50med m1* m2* /*m3**/ m5* dho_m1* dho_m2* /*dho_m5**/ dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.0
estat ic 

regress total50med m1* m2* /*m3**/ m5* dho_m1* dho_m2* dho_m5* /*dho_m6**/ i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.8
estat ic 

*** model 3 counting geographichal factors excluding one by one - Excluding m3* | dho_m1*

regress total50med /*m1**/ m2* /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.1
estat ic 

regress total50med m1* /*m2**/ /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.7
estat ic 

regress total50med m1* m2* /*m3**//* m5**/ /*dho_m1**/ dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 28.3
estat ic 

regress total50med m1* m2* /*m3**/ m5* /*dho_m1**/ /*dho_m2**/ dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.6
estat ic 

regress total50med m1* m2* /*m3**/ m5* /*dho_m1**/ dho_m2* /*dho_m5**/ dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.0
estat ic 

regress total50med m1* m2* /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* /*dho_m6**/ i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.8
estat ic 

*** model 4 counting geographichal factors excluding one by one - Excluding m3* | dho_m1*| m2*

regress total50med /*m1**/ /*m2**/ /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 26.6
estat ic 

regress total50med m1* /*m2**/ /*m3**/ /*m5**/ /*dho_m1**/ dho_m2* dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 28.1
estat ic 

regress total50med m1* /*m2**/ /*m3**/ m5* /*dho_m1**/ /*dho_m2**/ dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.5
estat ic 

regress total50med m1* /*m2**/ /*m3**/ m5* /*dho_m1**/ dho_m2* /*dho_m5**/ dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 28.9
estat ic 

regress total50med m1* /*m2**/ /*m3**/ m5* /*dho_m1**/ dho_m2* dho_m5* /*dho_m6**/ i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.6
estat ic 

*** model 5 counting geographichal factors excluding one by one - Excluding m3* | dho_m1*| m2* | dho_m2*

regress total50med /*m1**/ /*m2**/ /*m3**/ m5* /*dho_m1**/ /*dho_m2**/ dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 26.5
estat ic 

regress total50med m1* /*m2**/ /*m3**/ /*m5**/ /*dho_m1**/ /*dho_m2**/ dho_m5* dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 28.0
estat ic 

regress total50med m1* /*m2**/ /*m3**/ m5* /*dho_m1**/ /*dho_m2**/ /*dho_m5**/ dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 28.6
estat ic 

regress total50med m1* /*m2**/ /*m3**/ m5* /*dho_m1**/ /*dho_m2**/ dho_m5* /*dho_m6**/ i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.3
estat ic 

*** model 6 counting geographichal factors excluding one by one - Excluding m3* | dho_m1*| m2* | dho_m2* | dho_m5*

regress total50med /*m1**/ /*m2**/ /*m3**/ m5* /*dho_m1**/ /*dho_m2**/ /*dho_m5**/ dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 25.7
estat ic 

regress total50med m1* /*m2**/ /*m3**/ /*m5**/ /*dho_m1**/ /*dho_m2**/ /*dho_m5**/ dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.2
estat ic 

regress total50med m1* /*m2**/ /*m3**/ m5* /*dho_m1**/ /*dho_m2**/ /*dho_m5**/ /*dho_m6**/ i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 27.0
estat ic 

*** model 7 counting geographichal factors excluding one by one - Excluding m3* | dho_m1*| m2* | dho_m2* | dho_m5* | m5**

regress total50med /*m1**/ /*m2**/ /*m3**/ /*m5**/ /*dho_m1**/ /*dho_m2**/ /*dho_m5**/ dho_m6* i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 22.4

regress total50med m1* /*m2**/ /*m3**/ /*m5**/ /*dho_m1**/ /*dho_m2**/ /*dho_m5**/ /*dho_m6**/ i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 25.6
estat ic 

*** model 8 counting geographichal factors excluding one by one - Excluding m3* | dho_m1*| m2* | dho_m2* | dho_m5* | m5** | dho_m6*

regress total50med /*m1**/ /*m2**/ /*m3**/ /*m5**/ /*dho_m1**/ /*dho_m2**/ /*dho_m5**/ /*dho_m6**/ i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 20.5
estat ic 

*** model 9 counting geographichal factors excluding one by one - Excluding m3* | dho_m1*| m2* | dho_m2* | dho_m5* | m5** | dho_m6* | 

*model for report

regress total50med   i.m7_recode_B3R6V2 m7_PC_distance_km m7_PHC_distance_km m1* m2* m3* m5* i.dho_m7_areatype dho_m7_pctPBI2019 i.dho_m7_NAPBDD_t dho_m7_access_ad_district i.dho_m7_pulau i.dho_m7_ficalcapacity dho_m1* dho_m2* dho_m5*  dho_m6* i.pro_m7_recode_prov_idx_num i.pro_m7_islands pro_m7_prov_percent_popu pro_m7_Percentase_APBDkesehatan total50med_nn2 // R-squared: 29.9
estat ic 






